<%@page import="java.util.*" %>
<%@page import="edu.chiansoft.javabean.People" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
List<Integer> intForList=new ArrayList<Integer>();
intForList.add(1);
intForList.add(3);
intForList.add(6);
intForList.add(9);
List<People> peopleForList=new ArrayList<People>();
peopleForList.add(new People(1,"fly01",1));
peopleForList.add(new People(2,"fly02",2));
peopleForList.add(new People(3,"fly03",3));
peopleForList.add(new People(4,"fly04",4));
pageContext.setAttribute("key01", intForList);
pageContext.setAttribute("key02", peopleForList);
%>
<h3>域里的value值得类型为list</h3>
<h4>获取list里某个元素的内容：</h4>
${key01[03] }<br>
name:${key02[2].name };id:${key02[2].id };age:${key02[2].age }<br>
<h4>获取list里所有元素的内容：</h4>
<c:forEach var="element01" items="${key01 }">
${element01 }<br>
</c:forEach>
<hr>
<c:forEach var="element02" items="${key02 }">
id:${element02.id };name:${element02.name };age:${key02[2].age }<br>
</c:forEach>
</body>
</html>